#ifndef NANE_SCRIPTMODULEIMPL__H
#   define NANE_SCRIPTMODULEIMPL__H

#   include "nane/ScriptSystem/ScriptModule.h"
#   include "nane/ScriptSystem/ScriptSystemImpl_.h"

#   include <string>
#   include <vector>

namespace nane
{
    class ScriptModule::Implementation
        : public SubSystemProductImpl<ScriptModule::Implementation, ScriptSystem::Implementation, IScriptModule*>
    {
    public:
        Implementation( ScriptSystem::Implementation* _creator, IScriptModule* _interface, const char* _name );
        ~Implementation();
        
    public:
        void Release( ScriptObject::Implementation* _scriptObjectImpl );

    public:
        struct ExportedFunction
        {
            std::string className;
            std::string name;
            ScriptObject function;
        };
        
        struct ExportedFunctionFindName
        {
            const char* m_class;
            const char* m_name;

            ExportedFunctionFindName( const char* _class, const char* _name )
                : m_class( _class )
                , m_name( _name )
            {

            }

            bool operator()( const ExportedFunction& _exportedFunction )
            {
                return std::strcmp(m_class, _exportedFunction.className.c_str()) == 0
                        && std::strcmp(m_name, _exportedFunction.name.c_str()) == 0;
            }
        };
        
        struct ExportedFunctionFindNameStd
        {
            const std::string& m_class;
            const std::string& m_name;

            ExportedFunctionFindNameStd( const std::string& _class, const std::string& _name )
                : m_class( _class )
                , m_name( _name )
            {

            }

            bool operator()( const ExportedFunction& _exportedFunction )
            {
                return m_class == _exportedFunction.className
                        && m_name == _exportedFunction.name;
            }
        };
        
        
    public:
        std::string name;
        typedef std::vector<ExportedFunction> TExportedFunctionVector;
        TExportedFunctionVector exportedFunctions;
    };
}   // namespace nane

#endif	// NANE_SCRIPTMODULEIMPL__H
